import 'package:flutter_module/page/welfare_ranking/welfare_ranking_list_item.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../common/base/page/BasePage.dart';
import '../../../common/base/page/BasicListPage.dart';
import '../../../common/widgets/LoadStateWidget.dart';
import 'welfare_ranking_list_item_logic.dart';

class WelfareRankingListItemPage extends BasePage {
  final logic = Get.put(WelfareRankingListItemLogic());

  WelfareRankingListItemPage({super.key});

  @override
  State<StatefulWidget> createState() => WelfareRankingListItemPageState();
}

class WelfareRankingListItemPageState extends BasicListPage<
    WelfareRankingListItemPage, WelfareRankingListItemLogic> {
  @override
  WelfareRankingListItemLogic get currentLogic => widget.logic;

  @override
  Widget? footView() {
    final isShowMySelf = currentLogic.state.isShowMySelf;
    if (!isShowMySelf) {
      return null;
    }
    return Obx(() {
      return WelfareRankingListItem(
        isMysel: true,
        user: currentLogic.state.myInfo.value,
      );
    });
  }

  @override
  EmptyType? emptyType() {
    return EmptyType.Empty_Welfare_Ranking;
  }

  @override
  Widget listItem(int i) {
    return Container(
      margin: const EdgeInsets.fromLTRB(15, 0, 15, 0),
      child: WelfareRankingListItem(
          isMysel: false, user: currentLogic.dataList[i]),
    );
  }

  @override
  String screenName() {
    return "";
  }

  @override
  void footerRetryRefresh() {
    currentLogic.refreshController.requestLoading();
  }

  @override
  bool isNeedAppBar() {
    return false;
  }

  @override
  bool ifNeedScaffold() {
    return false;
  }
}
